package com.wgts.wgts.mvp.view.activity.myorder;

import android.content.Context;
import android.support.annotation.NonNull;
import android.support.v4.content.ContextCompat;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.wgts.wgts.R;
import com.wgts.wgts.netmodle.resp.ChangeGoodsPlanEntity;

import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;

/*
 *
 *
 *   data:2018/9/2514:44
 *
 */public class AfterSaleAdapter extends RecyclerView.Adapter<AfterSaleAdapter.ViewHold> {
    private Context context;
    private List<ChangeGoodsPlanEntity> list;

    public AfterSaleAdapter(Context context, List<ChangeGoodsPlanEntity> list) {
        this.context = context;
        this.list = list;
    }

    @NonNull
    @Override
    public ViewHold onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) {
        return new ViewHold(LayoutInflater.from(context).inflate
                (R.layout.my_order_after_sale_recycle_item, viewGroup, false));
    }

    @Override
    public void onBindViewHolder(@NonNull ViewHold viewHold, int i) {
        viewHold.logisticsMessage.setText(list.get(i).progress);
        viewHold.logisticsDay.setText(String.valueOf(list.get(i).date));
        viewHold.logisticsTime.setText(list.get(i).time);
    }

    @Override
    public int getItemCount() {
        return list.size();
    }

    public class ViewHold extends RecyclerView.ViewHolder {
        @BindView(R.id.logistics_time)
        TextView logisticsTime;
        @BindView(R.id.logistics_day)
        TextView logisticsDay;
        @BindView(R.id.logistics_message)
        TextView logisticsMessage;
        public ViewHold(@NonNull View itemView) {
            super(itemView);
            ButterKnife.bind(this, itemView);
        }
    }
}
